Class NetworkObject
Inheritance
System.Object
UnityEngine.Object
UnityEngine.Component
UnityEngine.Behaviour
UnityEngine.MonoBehaviour
NetworkObject
Inherited Members
UnityEngine.MonoBehaviour.IsInvoking()
UnityEngine.MonoBehaviour.CancelInvoke()
UnityEngine.MonoBehaviour.Invoke(System.String, System.Single)
UnityEngine.MonoBehaviour.InvokeRepeating(System.String, System.Single, System.Single)
UnityEngine.MonoBehaviour.CancelInvoke(System.String)
UnityEngine.MonoBehaviour.IsInvoking(System.String)
UnityEngine.MonoBehaviour.StartCoroutine(System.String)
UnityEngine.MonoBehaviour.StartCoroutine(System.String, System.Object)
UnityEngine.MonoBehaviour.StartCoroutine(System.Collections.IEnumerator)
UnityEngine.MonoBehaviour.StartCoroutine_Auto(System.Collections.IEnumerator)
UnityEngine.MonoBehaviour.StopCoroutine(System.Collections.IEnumerator)
UnityEngine.MonoBehaviour.StopCoroutine(UnityEngine.Coroutine)
UnityEngine.MonoBehaviour.StopCoroutine(System.String)
UnityEngine.MonoBehaviour.StopAllCoroutines()
UnityEngine.MonoBehaviour.print(System.Object)
UnityEngine.MonoBehaviour.useGUILayout
UnityEngine.MonoBehaviour.runInEditMode
UnityEngine.Behaviour.enabled
UnityEngine.Behaviour.isActiveAndEnabled
UnityEngine.Component.GetComponent(System.Type)
UnityEngine.Component.GetComponent<T>()
UnityEngine.Component.TryGetComponent(System.Type, UnityEngine.Component)
UnityEngine.Component.TryGetComponent<T>(T)
UnityEngine.Component.GetComponent(System.String)
UnityEngine.Component.GetComponentInChildren(System.Type, System.Boolean)
UnityEngine.Component.GetComponentInChildren(System.Type)
UnityEngine.Component.GetComponentInChildren<T>(System.Boolean)
UnityEngine.Component.GetComponentInChildren<T>()
UnityEngine.Component.GetComponentsInChildren(System.Type, System.Boolean)
UnityEngine.Component.GetComponentsInChildren(System.Type)
UnityEngine.Component.GetComponentsInChildren<T>(System.Boolean)
UnityEngine.Component.GetComponentsInChildren<T>(System.Boolean, System.Collections.Generic.List<T>)
UnityEngine.Component.GetComponentsInChildren<T>()
UnityEngine.Component.GetComponentsInChildren<T>(System.Collections.Generic.List<T>)
UnityEngine.Component.GetComponentInParent(System.Type, System.Boolean)
UnityEngine.Component.GetComponentInParent(System.Type)
UnityEngine.Component.GetComponentInParent<T>(System.Boolean)
UnityEngine.Component.GetComponentInParent<T>()
UnityEngine.Component.GetComponentsInParent(System.Type, System.Boolean)
UnityEngine.Component.GetComponentsInParent(System.Type)
UnityEngine.Component.GetComponentsInParent<T>(System.Boolean)
UnityEngine.Component.GetComponentsInParent<T>(System.Boolean, System.Collections.Generic.List<T>)
UnityEngine.Component.GetComponentsInParent<T>()
UnityEngine.Component.GetComponents(System.Type)
UnityEngine.Component.GetComponents(System.Type, System.Collections.Generic.List<UnityEngine.Component>)
UnityEngine.Component.GetComponents<T>(System.Collections.Generic.List<T>)
UnityEngine.Component.GetComponents<T>()
UnityEngine.Component.CompareTag(System.String)
UnityEngine.Component.SendMessageUpwards(System.String, System.Object, UnityEngine.SendMessageOptions)
UnityEngine.Component.SendMessageUpwards(System.String, System.Object)
UnityEngine.Component.SendMessageUpwards(System.String)
UnityEngine.Component.SendMessageUpwards(System.String, UnityEngine.SendMessageOptions)
UnityEngine.Component.SendMessage(System.String, System.Object)
UnityEngine.Component.SendMessage(System.String)
UnityEngine.Component.SendMessage(System.String, System.Object, UnityEngine.SendMessageOptions)
UnityEngine.Component.SendMessage(System.String, UnityEngine.SendMessageOptions)
UnityEngine.Component.BroadcastMessage(System.String, System.Object, UnityEngine.SendMessageOptions)
UnityEngine.Component.BroadcastMessage(System.String, System.Object)
UnityEngine.Component.BroadcastMessage(System.String)
UnityEngine.Component.BroadcastMessage(System.String, UnityEngine.SendMessageOptions)
UnityEngine.Component.transform
UnityEngine.Component.gameObject
UnityEngine.Component.tag
UnityEngine.Object.GetInstanceID()
UnityEngine.Object.GetHashCode()
UnityEngine.Object.Equals(System.Object)
UnityEngine.Object.Instantiate(UnityEngine.Object, UnityEngine.Vector3, UnityEngine.Quaternion)
UnityEngine.Object.Instantiate(UnityEngine.Object, UnityEngine.Vector3, UnityEngine.Quaternion, UnityEngine.Transform)
UnityEngine.Object.Instantiate(UnityEngine.Object)
UnityEngine.Object.Instantiate(UnityEngine.Object, UnityEngine.Transform)
UnityEngine.Object.Instantiate(UnityEngine.Object, UnityEngine.Transform, System.Boolean)
UnityEngine.Object.Instantiate<T>(T)
UnityEngine.Object.Instantiate<T>(T, UnityEngine.Vector3, UnityEngine.Quaternion)
UnityEngine.Object.Instantiate<T>(T, UnityEngine.Vector3, UnityEngine.Quaternion, UnityEngine.Transform)
UnityEngine.Object.Instantiate<T>(T, UnityEngine.Transform)
UnityEngine.Object.Instantiate<T>(T, UnityEngine.Transform, System.Boolean)
UnityEngine.Object.Destroy(UnityEngine.Object, System.Single)
UnityEngine.Object.Destroy(UnityEngine.Object)
UnityEngine.Object.DestroyImmediate(UnityEngine.Object, System.Boolean)
UnityEngine.Object.DestroyImmediate(UnityEngine.Object)
UnityEngine.Object.FindObjectsOfType(System.Type)
UnityEngine.Object.FindObjectsOfType(System.Type, System.Boolean)
UnityEngine.Object.FindObjectsByType(System.Type, UnityEngine.FindObjectsSortMode)
UnityEngine.Object.FindObjectsByType(System.Type, UnityEngine.FindObjectsInactive, UnityEngine.FindObjectsSortMode)
UnityEngine.Object.DontDestroyOnLoad(UnityEngine.Object)
UnityEngine.Object.DestroyObject(UnityEngine.Object, System.Single)
UnityEngine.Object.DestroyObject(UnityEngine.Object)
UnityEngine.Object.FindSceneObjectsOfType(System.Type)
UnityEngine.Object.FindObjectsOfTypeIncludingAssets(System.Type)
UnityEngine.Object.FindObjectsOfType<T>()
UnityEngine.Object.FindObjectsByType<T>(UnityEngine.FindObjectsSortMode)
UnityEngine.Object.FindObjectsOfType<T>(System.Boolean)
UnityEngine.Object.FindObjectsByType<T>(UnityEngine.FindObjectsInactive, UnityEngine.FindObjectsSortMode)
UnityEngine.Object.FindObjectOfType<T>()
UnityEngine.Object.FindObjectOfType<T>(System.Boolean)
UnityEngine.Object.FindFirstObjectByType<T>()
UnityEngine.Object.FindAnyObjectByType<T>()
UnityEngine.Object.FindFirstObjectByType<T>(UnityEngine.FindObjectsInactive)
UnityEngine.Object.FindAnyObjectByType<T>(UnityEngine.FindObjectsInactive)
UnityEngine.Object.FindObjectsOfTypeAll(System.Type)
UnityEngine.Object.FindObjectOfType(System.Type)
UnityEngine.Object.FindFirstObjectByType(System.Type)
UnityEngine.Object.FindAnyObjectByType(System.Type)
UnityEngine.Object.FindObjectOfType(System.Type, System.Boolean)
UnityEngine.Object.FindFirstObjectByType(System.Type, UnityEngine.FindObjectsInactive)
UnityEngine.Object.FindAnyObjectByType(System.Type, UnityEngine.FindObjectsInactive)
UnityEngine.Object.name
UnityEngine.Object.hideFlags
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Assembly: FishNet.Runtime.dll
Syntax
[DisallowMultipleComponent]
public class NetworkObject : MonoBehaviour, IOrderable
Fields
NetworkBehaviours
Current Networkbehaviours.
Declaration
[HideInInspector]
public List<NetworkBehaviour> NetworkBehaviours
Field Value
NetworkObserver
NetworkObserver on this object.
Declaration
[HideInInspector]
public NetworkObserver NetworkObserver
Field Value
Observers
Clients which can see and get messages from this NetworkObject.
Declaration
[HideInInspector]
public HashSet<NetworkConnection> Observers
Field Value
UNSET_OBJECTID_VALUE
Value used when the ObjectId has not been set.
Declaration
public const int UNSET_OBJECTID_VALUE = 65535
Field Value
| Type |
Description |
| System.Int32 |
|
UNSET_PREFABID_VALUE
Value used when the PrefabId has not been set.
Declaration
public const int UNSET_PREFABID_VALUE = 65535
Field Value
| Type |
Description |
| System.Int32 |
|
UNSET_SCENEID_VALUE
Value used when the ObjectId has not been set.
Declaration
public const int UNSET_SCENEID_VALUE = 0
Field Value
| Type |
Description |
| System.Int32 |
|
Properties
AssetPathHash
Hash for the path which this asset resides. This value is set during edit time.
Declaration
public ulong AssetPathHash { get; }
Property Value
| Type |
Description |
| System.UInt64 |
|
ClientManager
ClientManager for this object.
Declaration
public ClientManager ClientManager { get; }
Property Value
ComponentIndex
ComponentIndex for this NetworkBehaviour.
Declaration
public byte ComponentIndex { get; }
Property Value
| Type |
Description |
| System.Byte |
|
EnablePrediction
True if this object uses prediciton methods.
Declaration
public bool EnablePrediction { get; }
Property Value
| Type |
Description |
| System.Boolean |
|
EnableStateForwarding
True to forward replicate and reconcile states to all clients. This is ideal with games where you want all clients and server to run the same inputs. False to only use prediction on the owner, and synchronize to spectators using other means such as a NetworkTransform.
Declaration
public bool EnableStateForwarding { get; }
Property Value
| Type |
Description |
| System.Boolean |
|
HasAuthority
True if IsOwner, or if IsServerInitialized with no Owner.
Declaration
[PreventUsageInside("global::FishNet.Object.NetworkBehaviour", "OnStartServer", "")]
[PreventUsageInside("global::FishNet.Object.NetworkBehaviour", "OnStartNetwork", " Use (base.Owner.IsLocalClient || (base.IsServerInitialized && !Owner.Isvalid) instead.")]
[PreventUsageInside("global::FishNet.Object.NetworkBehaviour", "Awake", "")]
[PreventUsageInside("global::FishNet.Object.NetworkBehaviour", "Start", "")]
public bool HasAuthority { get; }
Property Value
| Type |
Description |
| System.Boolean |
|
InitializedNestedNetworkObjects
Nested NetworkObjects that existed during initialization.
Declaration
public List<NetworkObject> InitializedNestedNetworkObjects { get; }
Property Value
InitializedParentNetworkBehaviour
NetworkBehaviour on the root of a NetworkObject parenting this instance. Value will be null if there was no parent during serialization.
Declaration
public NetworkBehaviour InitializedParentNetworkBehaviour { get; }
Property Value
IsClient
Declaration
[Obsolete("Use IsClientInitialized. Note the difference between IsClientInitialized and IsClientStarted.")]
public bool IsClient { get; }
Property Value
| Type |
Description |
| System.Boolean |
|
IsClientInitialized
True if this object has been initialized on the client side.
This is set true right before client start callbacks and after stop callbacks.
Declaration
public bool IsClientInitialized { get; }
Property Value
| Type |
Description |
| System.Boolean |
|
IsClientOnly
Declaration
[Obsolete("Use IsClientOnlyInitialized. Note the difference between IsClientOnlyInitialized and IsClientOnlyStarted.")]
public bool IsClientOnly { get; }
Property Value
| Type |
Description |
| System.Boolean |
|
IsClientOnlyInitialized
True if this object has been initialized only on the server side.
This is set true right before server start callbacks and after stop callbacks.
Declaration
public bool IsClientOnlyInitialized { get; }
Property Value
| Type |
Description |
| System.Boolean |
|
IsClientOnlyStarted
True if only the client is started and authenticated.
Declaration
public bool IsClientOnlyStarted { get; }
Property Value
| Type |
Description |
| System.Boolean |
|
IsClientStarted
True if the client is started and authenticated. This will return true on clientHost even if the object has not initialized yet for the client.
To check if this object has been initialized for the client use IsClientInitialized.
Declaration
public bool IsClientStarted { get; }
Property Value
| Type |
Description |
| System.Boolean |
|
IsGlobal
True to make this object global, and added to the DontDestroyOnLoad scene. This value may only be set for instantiated objects, and can be changed if done immediately after instantiating.
Declaration
public bool IsGlobal { get; }
Property Value
| Type |
Description |
| System.Boolean |
|
IsHost
Declaration
[Obsolete("Use IsHostInitialized. Note the difference between IsHostInitialized and IsHostStarted.")]
public bool IsHost { get; }
Property Value
| Type |
Description |
| System.Boolean |
|
IsHostInitialized
True if this object has been initialized on the server and client side.
Declaration
public bool IsHostInitialized { get; }
Property Value
| Type |
Description |
| System.Boolean |
|
IsHostStarted
True if client and server are started.
Declaration
public bool IsHostStarted { get; }
Property Value
| Type |
Description |
| System.Boolean |
|
IsManagerReconciling
True if a reconcile is occuring on the PredictionManager. Note the difference between this and IsBehaviourReconciling.
Declaration
public bool IsManagerReconciling { get; }
Property Value
| Type |
Description |
| System.Boolean |
|
IsNested
True if this object is nested.
This value is automatically applied for prefabs and scene objects during serialization. However, if changing parents at runtime use NetworkObject.SetParent().
Declaration
public bool IsNested { get; }
Property Value
| Type |
Description |
| System.Boolean |
|
IsNetworked
True if the object will always initialize as a networked object. When false the object will not automatically initialize over the network. Using Spawn() on an object will always set that instance as networked.
To check if server or client has been initialized on this object use IsXYZInitialized.
Declaration
public bool IsNetworked { get; }
Property Value
| Type |
Description |
| System.Boolean |
|
IsObjectReconciling
True if a reconcile is occuring on any NetworkBehaviour that is on or nested of this NetworkObject. Runtime NetworkBehaviours are not included, such as if you child a NetworkObject to another at runtime.
Declaration
public bool IsObjectReconciling { get; }
Property Value
| Type |
Description |
| System.Boolean |
|
IsOffline
True if client nor server are started.
Declaration
public bool IsOffline { get; }
Property Value
| Type |
Description |
| System.Boolean |
|
IsOwner
True if the local client is the owner of this object.
This will only return true if IsClientInitialized is also true. You may check ownership status regardless of client initialized state by using Owner.IsLocalClient.
Declaration
[PreventUsageInside("global::FishNet.Object.NetworkBehaviour", "OnStartServer", "")]
[PreventUsageInside("global::FishNet.Object.NetworkBehaviour", "OnStartNetwork", " Use base.Owner.IsLocalClient instead.")]
[PreventUsageInside("global::FishNet.Object.NetworkBehaviour", "Awake", "")]
[PreventUsageInside("global::FishNet.Object.NetworkBehaviour", "Start", "")]
public bool IsOwner { get; }
Property Value
| Type |
Description |
| System.Boolean |
|
IsOwnerOrServer
True if IsOwner, or if IsServerInitialized with no Owner.
Declaration
[PreventUsageInside("global::FishNet.Object.NetworkBehaviour", "OnStartServer", "")]
[PreventUsageInside("global::FishNet.Object.NetworkBehaviour", "OnStartNetwork", " Use (base.Owner.IsLocalClient || (base.IsServerInitialized && !Owner.Isvalid) instead.")]
[PreventUsageInside("global::FishNet.Object.NetworkBehaviour", "Awake", "")]
[PreventUsageInside("global::FishNet.Object.NetworkBehaviour", "Start", "")]
public bool IsOwnerOrServer { get; }
Property Value
| Type |
Description |
| System.Boolean |
|
IsSceneObject
Returns if this object was placed in the scene during edit-time.
Declaration
public bool IsSceneObject { get; }
Property Value
| Type |
Description |
| System.Boolean |
|
IsServer
Declaration
[Obsolete("Use IsServerInitialized. Note the difference between IsServerInitialized and IsServerStarted.")]
public bool IsServer { get; }
Property Value
| Type |
Description |
| System.Boolean |
|
IsServerInitialized
True if this object has been initialized on the server side.
This is set true right before server start callbacks and after stop callbacks.
Declaration
public bool IsServerInitialized { get; }
Property Value
| Type |
Description |
| System.Boolean |
|
IsServerOnly
Declaration
[Obsolete("Use IsServerOnlyInitialized. Note the difference between IsServerOnlyInitialized and IsServerOnlyStarted.")]
public bool IsServerOnly { get; }
Property Value
| Type |
Description |
| System.Boolean |
|
IsServerOnlyInitialized
True if this object has been initialized only on the server side.
This is set true right before server start callbacks and after stop callbacks.
Declaration
public bool IsServerOnlyInitialized { get; }
Property Value
| Type |
Description |
| System.Boolean |
|
IsServerOnlyStarted
True if only the server is started.
Declaration
public bool IsServerOnlyStarted { get; }
Property Value
| Type |
Description |
| System.Boolean |
|
IsServerStarted
True if the server is active. This will return true on clientHost even if the object is being deinitialized on the server.
To check if this object has been initialized for the server use IsServerInitialized.
Declaration
public bool IsServerStarted { get; }
Property Value
| Type |
Description |
| System.Boolean |
|
IsSpawnable
True if the object can be spawned at runtime; this is generally false for scene prefabs you do not spawn.
Declaration
public bool IsSpawnable { get; }
Property Value
| Type |
Description |
| System.Boolean |
|
IsSpawned
True if the object is initialized for the network.
Declaration
public bool IsSpawned { get; }
Property Value
| Type |
Description |
| System.Boolean |
|
LocalConnection
The local connection of the client calling this method.
Declaration
public NetworkConnection LocalConnection { get; }
Property Value
NetworkManager
NetworkManager for this object.
Declaration
public NetworkManager NetworkManager { get; }
Property Value
ObjectId
Unique Id for this NetworkObject. This does not represent the object owner.
Declaration
public int ObjectId { get; }
Property Value
| Type |
Description |
| System.Int32 |
|
ObserverManager
ObserverManager for this object.
Declaration
public ObserverManager ObserverManager { get; }
Property Value
Order
This is for internal use. Returns the order to initialize the object.
Declaration
public int Order { get; }
Property Value
| Type |
Description |
| System.Int32 |
|
Owner
Declaration
public NetworkConnection Owner { get; }
Property Value
OwnerId
ClientId for this NetworkObject owner.
Declaration
public int OwnerId { get; }
Property Value
| Type |
Description |
| System.Int32 |
|
PredictedOwner
PredictedOwner component on this object. Will be null if not added manually.
Declaration
public PredictedOwner PredictedOwner { get; }
Property Value
PredictedSpawn
PredictedSpawn component on this object. Will be null if not added manually.
Declaration
public PredictedSpawn PredictedSpawn { get; }
Property Value
PredictedSpawner
NetworkConnection which predicted spawned this object.
Declaration
public NetworkConnection PredictedSpawner { get; }
Property Value
PredictionManager
PredictionManager for this object.
Declaration
public PredictionManager PredictionManager { get; }
Property Value
PredictionSmoother
Graphical smoother to use when using set for owner.
Declaration
public ChildTransformTickSmoother PredictionSmoother { get; }
Property Value
PrefabId
Networked PrefabId assigned to this Prefab.
Declaration
public ushort PrefabId { get; }
Property Value
| Type |
Description |
| System.UInt16 |
|
RigidbodyPauser
Pauses and unpauses rigidbodies when they do not have data to reconcile to.
Declaration
public RigidbodyPauser RigidbodyPauser { get; }
Property Value
RollbackManager
RollbackManager for this object.
Declaration
public RollbackManager RollbackManager { get; }
Property Value
RuntimeChildNetworkBehaviours
NetworkObjects which are made child at runtime using NetworkObject.SetParent.
This is exposed only for low-level use and may change without notice.
Declaration
[HideInInspector]
public List<NetworkBehaviour> RuntimeChildNetworkBehaviours { get; }
Property Value
RuntimeParentNetworkBehaviour
NetworkBehaviour parenting this object when set at runtime using NetworkObject/NetworkBehaviour.SetParent.
This is exposed only for low-level use and may change without notice.
Declaration
[HideInInspector]
public NetworkBehaviour RuntimeParentNetworkBehaviour { get; }
Property Value
SceneManager
SceneManager for this object.
Declaration
public SceneManager SceneManager { get; }
Property Value
ServerManager
ServerManager for this object.
Declaration
public ServerManager ServerManager { get; }
Property Value
SpawnableCollectionId
Spawn collection to use assigned to this Prefab.
Declaration
public ushort SpawnableCollectionId { get; }
Property Value
| Type |
Description |
| System.UInt16 |
|
TimeManager
TimeManager for this object.
Declaration
public TimeManager TimeManager { get; }
Property Value
TransportManager
TransportManager for this object.
Declaration
public TransportManager TransportManager { get; }
Property Value
Methods
Awake()
Declaration
protected virtual void Awake()
Broadcast<T>(T, Boolean, Channel)
Sends a broadcast to Observers on this NetworkObject.
Declaration
public void Broadcast<T>(T message, bool requireAuthenticated = true, Channel channel = Channel.Reliable)
where T : struct, IBroadcast
Parameters
| Type |
Name |
Description |
| T |
message |
Broadcast data being sent; for example: an instance of your broadcast type.
|
| System.Boolean |
requireAuthenticated |
True if the client must be authenticated for this broadcast to send.
|
| Channel |
channel |
Channel to send on.
|
Type Parameters
| Name |
Description |
| T |
Type of broadcast to send.
|
Despawn(NetworkObject, Nullable<DespawnType>)
Despawns a NetworkObject. Only call from the server.
Declaration
public void Despawn(NetworkObject nob, DespawnType? despawnType = null)
Parameters
| Type |
Name |
Description |
| NetworkObject |
nob |
NetworkObject to despawn.
|
| System.Nullable<DespawnType> |
despawnType |
What happens to the object after being despawned.
|
Despawn(Nullable<DespawnType>)
Despawns this NetworkObject. Only call from the server.
Declaration
public void Despawn(DespawnType? despawnType = null)
Parameters
| Type |
Name |
Description |
| System.Nullable<DespawnType> |
despawnType |
What happens to the object after being despawned.
|
Despawn(GameObject, Nullable<DespawnType>)
Despawns a GameObject. Only call from the server.
Declaration
public void Despawn(GameObject go, DespawnType? despawnType = null)
Parameters
| Type |
Name |
Description |
| UnityEngine.GameObject |
go |
GameObject to despawn.
|
| System.Nullable<DespawnType> |
despawnType |
What happens to the object after being despawned.
|
GetDefaultDespawnType()
True to use configured ObjectPool rather than destroy this NetworkObject when being despawned. Scene objects are never destroyed.
Declaration
public DespawnType GetDefaultDespawnType()
Returns
GetGraphicalObject()
Gets the current graphical object for prediction.
Declaration
public Transform GetGraphicalObject()
Returns
| Type |
Description |
| UnityEngine.Transform |
|
GetInitializeOrder()
Order to initialize this object's callbacks when spawned with other NetworkObjects in the same tick. Default value is 0, negative values will execute callbacks first.
Declaration
public sbyte GetInitializeOrder()
Returns
| Type |
Description |
| System.SByte |
|
GetInstance<T>()
Returns class of type if found within CodegenBase classes.
Declaration
public T GetInstance<T>()
where T : Component
Returns
Type Parameters
GetNetworkBehaviour(Byte, Boolean)
Returns a NetworkBehaviour on this NetworkObject.
Declaration
public NetworkBehaviour GetNetworkBehaviour(byte componentIndex, bool error)
Parameters
| Type |
Name |
Description |
| System.Byte |
componentIndex |
ComponentIndex of the NetworkBehaviour.
|
| System.Boolean |
error |
True to error if not found.
|
Returns
GiveOwnership(NetworkConnection)
Gives ownership to newOwner.
Declaration
public void GiveOwnership(NetworkConnection newOwner)
Parameters
GiveOwnership(NetworkConnection, Boolean)
Gives ownership to newOwner.
Declaration
public void GiveOwnership(NetworkConnection newOwner, bool asServer)
Parameters
HasInstance<T>()
Returns if an instance exists for type.
Declaration
public bool HasInstance<T>()
where T : Component
Returns
| Type |
Description |
| System.Boolean |
|
Type Parameters
RegisterInstance<T>(T, Boolean)
Registers a new component to this NetworkManager.
Declaration
public void RegisterInstance<T>(T component, bool replace = true)
where T : Component
Parameters
| Type |
Name |
Description |
| T |
component |
Reference of the component being registered.
|
| System.Boolean |
replace |
True to replace existing references.
|
Type Parameters
| Name |
Description |
| T |
Type to register.
|
RegisterInvokeOnInstance<T>(Action<Component>)
Invokes an action when a specified component becomes registered. Action will invoke immediately if already registered.
Declaration
public void RegisterInvokeOnInstance<T>(Action<Component> handler)
where T : Component
Parameters
| Type |
Name |
Description |
| System.Action<UnityEngine.Component> |
handler |
Action to invoke.
|
Type Parameters
| Name |
Description |
| T |
Component type.
|
RemoveOwnership(Boolean)
Removes ownership from all clients.
Declaration
public void RemoveOwnership(bool includeNested = false)
Parameters
| Type |
Name |
Description |
| System.Boolean |
includeNested |
|
ResetState(Boolean)
Resets the state of this NetworkObject.
This is used internally and typically with custom object pooling.
Declaration
public void ResetState(bool asServer)
Parameters
| Type |
Name |
Description |
| System.Boolean |
asServer |
|
SetAssetPathHash(UInt64)
Sets AssetPathhash value.
Declaration
public void SetAssetPathHash(ulong value)
Parameters
| Type |
Name |
Description |
| System.UInt64 |
value |
Value to use.
|
SetDefaultDespawnType(DespawnType)
Declaration
public void SetDefaultDespawnType(DespawnType despawnType)
Parameters
| Type |
Name |
Description |
| DespawnType |
despawnType |
Default despawn type for this NetworkObject.
|
Sets a new graphical object for prediction.
Declaration
public void SetGraphicalObject(Transform t)
Parameters
| Type |
Name |
Description |
| UnityEngine.Transform |
t |
|
SetIsGlobal(Boolean)
Declaration
public void SetIsGlobal(bool value)
Parameters
| Type |
Name |
Description |
| System.Boolean |
value |
New global value.
|
SetIsNetworked(Boolean)
Sets IsNetworked value. This method must be called before Start.
Declaration
public void SetIsNetworked(bool value)
Parameters
| Type |
Name |
Description |
| System.Boolean |
value |
New IsNetworked value.
|
SetLocalOwnership(NetworkConnection)
Declaration
[Obsolete("Use SetLocalOwnership(NetworkConnection, bool).")]
public void SetLocalOwnership(NetworkConnection caller)
Parameters
SetLocalOwnership(NetworkConnection, Boolean)
Takes ownership of this object and child network objects, allowing immediate control.
Declaration
public void SetLocalOwnership(NetworkConnection caller, bool includeNested)
Parameters
| Type |
Name |
Description |
| NetworkConnection |
caller |
Connection to give ownership to.
|
| System.Boolean |
includeNested |
|
SetParent(NetworkBehaviour)
Sets this NetworkObject as a child of another at runtime.
Declaration
public void SetParent(NetworkBehaviour nb)
Parameters
| Type |
Name |
Description |
| NetworkBehaviour |
nb |
NetworkBehaviour to use as root. Use null to remove parenting.
|
SetParent(NetworkObject)
Sets this NetworkObject as a child of another at runtime.
Declaration
public void SetParent(NetworkObject nob)
Parameters
| Type |
Name |
Description |
| NetworkObject |
nob |
NetworkObject to use as root. Use null to remove parenting.
|
SetRenderersVisible(Boolean, Boolean)
Sets the renderer visibility for clientHost.
Declaration
public void SetRenderersVisible(bool visible, bool force = false)
Parameters
| Type |
Name |
Description |
| System.Boolean |
visible |
True if renderers are to be visibile.
|
| System.Boolean |
force |
True to skip blocking checks.
|
SetSceneId(UInt64)
Sets SceneId value. This is not synchronized automatically.
Declaration
public void SetSceneId(ulong sceneId)
Parameters
| Type |
Name |
Description |
| System.UInt64 |
sceneId |
|
Spawn(NetworkObject, NetworkConnection, Scene)
Spawns an object over the network. Only call from the server.
Declaration
public void Spawn(NetworkObject nob, NetworkConnection ownerConnection = null, Scene scene = default(Scene))
Parameters
Spawn(GameObject, NetworkConnection, Scene)
Spawns an object over the network. Only call from the server.
Declaration
public void Spawn(GameObject go, NetworkConnection ownerConnection = null, Scene scene = default(Scene))
Parameters
| Type |
Name |
Description |
| UnityEngine.GameObject |
go |
|
| NetworkConnection |
ownerConnection |
|
| UnityEngine.SceneManagement.Scene |
scene |
|
Start()
Declaration
protected virtual void Start()
ToString()
Outputs data about this NetworkObject to string.
Declaration
public override string ToString()
Returns
| Type |
Description |
| System.String |
|
Overrides
UnityEngine.Object.ToString()
TryGetInstance<T>(out T)
Returns class of type from registered instances.
Declaration
public bool TryGetInstance<T>(out T component)
where T : Component
Parameters
| Type |
Name |
Description |
| T |
component |
Outputted component.
|
Returns
| Type |
Description |
| System.Boolean |
True if was able to get instance.
|
Type Parameters
| Name |
Description |
| T |
Type to get.
|
TryRegisterInstance<T>(T)
Tries to registers a new component to this NetworkManager.
This will not register the instance if another already exists.
Declaration
public bool TryRegisterInstance<T>(T component)
where T : Component
Parameters
| Type |
Name |
Description |
| T |
component |
Reference of the component being registered.
|
Returns
| Type |
Description |
| System.Boolean |
True if was able to register, false if an instance is already registered.
|
Type Parameters
| Name |
Description |
| T |
Type to register.
|
UnregisterInstance<T>()
Unregisters a component from this NetworkManager.
Declaration
public void UnregisterInstance<T>()
where T : Component
Type Parameters
| Name |
Description |
| T |
Type to unregister.
|
UnregisterInvokeOnInstance<T>(Action<Component>)
Removes an action to be invoked when a specified component becomes registered.
Declaration
public void UnregisterInvokeOnInstance<T>(Action<Component> handler)
where T : Component
Parameters
| Type |
Name |
Description |
| System.Action<UnityEngine.Component> |
handler |
Action to invoke.
|
Type Parameters
| Name |
Description |
| T |
Component type.
|
UnsetParent()
Unsets this NetworkObject's parent at runtime.
Declaration
public void UnsetParent()
UpdateRenderers(Boolean)
Updates cached renderers used to managing clientHost visibility.
Declaration
public void UpdateRenderers(bool updateVisibility = true)
Parameters
| Type |
Name |
Description |
| System.Boolean |
updateVisibility |
True to also update visibility if clientHost.
|
Events
OnHostVisibilityUpdated
Called when the clientHost gains or loses visibility of this object.
Boolean value will be true if clientHost has visibility.
Declaration
public event NetworkObject.HostVisibilityUpdatedDelegate OnHostVisibilityUpdated
Event Type
OnObserversActive
Called when this NetworkObject losses all observers or gains observers while previously having none.
Declaration
public event Action<NetworkObject> OnObserversActive
Event Type
Implements